<?php
declare (strict_types = 1);

namespace app\api\controller\yuql;

use app\logic\yuql\PayLogic;
use app\logic\yuql\SeckillLogic;
use app\services\yuql\PayServices;
use think\facade\Log;
use think\Request;
use Yansongda\Pay\Pay;

class Alipay
{

    /**
     * yuql
     * 支付获取订单详情
     * @param Request $request
     * @return \think\response\Json
     * @throws \Exception
     */
    public function getGoodsOrder(Request $request){
        if (!$request->isGet()) throw new \Exception('请求方式不正确');
        try {
            $order_id = $request->get('order_id');
            PayLogic::getGoodsOrderLogic($order_id);
        } catch (\Exception $e){
            return writeJson(1002,'',$e->getMessage());
        }
    }

    /**
     * yuql
     * 返回用户购买结果
     * @return \Yansongda\Supports\Collection
     */
    public function returnPay(){
        return (new PayServices())->return();
    }

    /**
     * yuql
     * 向系统发送信息
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function notify(){
        return (new PayServices())->notify();
    }
}
